import {request} from '@/plugins/request';

export const getArticles = params => {
    return request({
        method: 'GET',
        url: '/api/articles',
        params
    });
}

export const getFeedArticles = params => {
    return request({
        method: 'GET',
        url: '/api/articles/feed',
        params
    });
}

export const like = (slug) => {
    return request({
        method: 'POST',
        url: `/api/articles/${slug}/favorite`,
    });
}

export const unlike = (slug) => {
    return request({
        method: 'DELETE',
        url: `/api/articles/${slug}/favorite`
    });
}

export const articleDetail = (slug) => {
    return request({
        method: 'GET',
        url: `/api/articles/${slug}`
    });
}